from kivy.properties import ObjectProperty
from kivy.uix.boxlayout import BoxLayout

from common import KvLoad, get_conf


class MyFileChooser(BoxLayout):
    load = ObjectProperty(None)
    cancel = ObjectProperty(None)

    def __init__(self, **kwargs):
        KvLoad.load(__file__)
        super().__init__(**kwargs)
        conf = get_conf()
        root_path = conf.get('path', 'rootpath')
        if root_path:
            self.ids.filechooser.rootpath = root_path
